package com.nut.lmsc.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nut.lmsc.entity.Order;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface OrderMapper extends BaseMapper<Order> {

    IPage<Order> listPage(Page page,
                          @Param("memberId") Long memberId,
                          @Param("orderId") String orderId,
                          @Param("shopId") Integer shopId,
                          @Param("name") String name,
                          @Param("mobile") String mobile,
                          @Param("status") Integer status,
                          @Param("startTime") String startTime,
                          @Param("endTime") String endTime,
                          @Param("code") String code
    );

    @Select("select * from biz_order where order_id=#{orderId} and deleted=0")
    Order selectByOrderId(@Param("orderId") String orderId);

    @Select("select count(*) from biz_order where code=#{code} and deleted=0")
    Integer selectByCode(@Param("code") String code);

}